<?php

/**
 * 记录用户的搜索关键字
 */
class SearchAR extends CActiveRecord {
	public static function model($className=__CLASS__){
		return parent::model($className);
	}

	public static function tblName(){
		return 'ccs8_search';
	}
	
	public function tableName(){
		return self::tblName();
	}
	
	public static function batchSave($lines){
		if(empty($lines)){
			return;
		}
		$sql = "insert into ccs8_search(keyword,ctime) values";
		$ctime = time();
		$itemArr = array();
		foreach($lines as $line){
			$line = mysql_escape_string($line);
			$itemArr[] = "('$line',$ctime)";
		}
		$sql .= join(',',$itemArr);
		DBUtil::exec($sql);
	}
}